<?php

namespace App\Providers;

use App\Models\ShopModel;
use App\Providers\OrderShipped;
use App\Sevrice\Es;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class SendShipmentNotification
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  \App\Providers\OrderShipped  $event
     * @return void
     */
    public function handle(OrderShipped $event)
    {
        $id=$event->newId;
        $data=ShopModel::where('shop_id',$id)->first()->toArray();
        $res=Es::one()->addInfo($id,$data);
        if($res){
            return ['code'=>200,'msg'=>'同步成功'];
        }
        return ['code'=>400,'msg'=>'同步失败'];
    }
}
